package com.xmls.server.controller;

import com.xmls.server.entity.FaultNotice;
import com.xmls.server.entity.Result;
import com.xmls.server.service.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@Api(tags = "报警相关接口")
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    @GetMapping()
    @ApiOperation("获取报警")
    public Result<List<FaultNotice>> getAllNotice() {

        return noticeService.findAll();
    }
    @GetMapping("/count")
    public Result<Integer> countTotal(){
        return noticeService.CountTotal();
    }

}
